<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>正则表达式</title>
		<script>
			var reg=/dog/ig;
			var str="Dog is not just a dog,but dog is our friends";
			var s1=str.replace(reg,"cat");
			alert(s1);
			//var phonereg=/1[3-9]\d{9}/;
			var phonereg=/^1[3-9]\d{9}$/;//表单元素的pattern默认有 ^ $
			var phone=window.prompt("你的手机号：","13865997763");
			alert(phonereg.test(phone));
		</script>
	</head>
	<body>
	</body>
</html>